﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Jxym.DBUtility;
using Jxym.wlkc2011.Module.CMS.MODEL;

namespace Jxym.wlkc2011.Module.CMS.SERVER
{
    public partial class contentType : System.Web.UI.Page
    {
        private int _start = 0;
        private int _limit = 0;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string rv = "[]";
                if (Request.Params["start"] != null)
                    _start = Convert.ToInt32(Request.Params["start"]);
                if (Request.Params["limit"] != null)
                    _limit = Convert.ToInt32(Request.Params["limit"]);
                MsSqlDal<Cms_ContentType> cct = new MsSqlDal<Cms_ContentType>();
                if (_limit > 0)
                {
                    IList<Cms_ContentType> list = cct.GetPageList("", null, _start, _limit);
                    Jxym.Common.JSON.PageBean pb = new Common.JSON.PageBean();
                    pb.List = list;
                    pb.Count = cct.GetPageCount("", null);
                    rv = Newtonsoft.Json.JsonConvert.SerializeObject(pb);
                }
                else
                {
                    IList<Cms_ContentType> list = cct.GetList("");
                    rv = Newtonsoft.Json.JsonConvert.SerializeObject(list);
                }
                Response.Write(rv);
            }
        }
    }
}